<HTML><HEAD>
<!--
    ---------------------
    Window Time 2: Digits
    ---------------------
-->

<SCRIPT LANGUAGE="JavaScript"><!-- hide from old browsers

/*
    THE JAVASCRIPT COOKBOOK by Erica Sadun, webrx@mindspring.com
    Copyright (C)1998 by Charles River Media.  All Rights Reserved.
    
    This applet can only be re-used or modifed by license holders of the
    JavaScript Cookbook CD-ROM.  Credit must be given in the source
    code and this copyright notice must be maintained. If you do
    not hold a license to the JavaScript Cookbook, you may NOT
    duplicate or modify this code for your own use.

    Use at your own risk. No warranty is given or implied of the suitability 
    of this applet for any specific application. Neither Erica Sadun nor 
    Charles River Media will be held responsible for any unwanted effects 
    due to the use of this applet or any derivative. 
*/


function getPath(aLocation) {
    var tmp = aLocation.substring(0,(aLocation.lastIndexOf("/")))
    tmp = tmp.substring(0,(tmp.lastIndexOf("/") + 1))
    return tmp + "GRAFX/DIGITS/DIGIT"
}

function setClock()
{
    var baseRef = getPath(parent.frames[1].document.location)
    var s1 = "<BODY BGCOLOR=\"000000\"><CENTER>"
    var s2 = "</CENTER></BODY>"
    
    var i1 = "<IMG SRC=\"" + baseRef
    var i2 = ".GIF\" HEIGHT=72 WIDTH=48>"
    
    // Get the time and recover the digits
    var now = new Date()
    h1 = parseInt((now.getHours())/10)
    if (h1 == 0) h1 = "X"
    h2 = parseInt((now.getHours())%10)
	var m = parseInt(now.getMinutes())
	if(m < 10)
		m1 = 0
	else
        m1 = parseInt(m/10)
    m2 = parseInt((now.getMinutes())%10)
    
    // Provide images for each digit
    parent.JCclock.document.open()
    parent.JCclock.document.write(s1)
    parent.JCclock.document.write(i1+h1+i2)
    parent.JCclock.document.write(i1+h2+i2)
    parent.JCclock.document.write(i1+"C.GIF\" HEIGHT=72 WIDTH=32>")
    parent.JCclock.document.write(i1+m1+i2)
    parent.JCclock.document.write(i1+m2+i2)
    parent.JCclock.document.write(s2)
    parent.JCclock.document.close()
    JSCTimeOutID = window.setTimeout('setClock()',60000)
}

<!-- done hiding --></SCRIPT></HEAD>

<BODY bgcolor="ffffff" link="0000ff" vlink="770077"
onload="JSCTimeOutID = window.setTimeout('setClock()',1000);">
    
    <FONT COLOR="007777"><H1><IMG SRC="../GRAFX/UTENS.JPG" WIDTH=80 HEIGHT=50
    ALIGN = LEFT>Window Time 2: Digits</H1></FONT>
    <BLOCKQUOTE><FONT COLOR="770000">
        This script sets the clock window below 
        to the current time.  In a slight variation from the
        prior recipe, this one adds digital numbers to the
        batter.
    </FONT></BLOCKQUOTE>
    
    <BR><BR>
    
    <FONT COLOR="007777"><H2>Discussion</H2></FONT>
    <FONT SIZE=4>
        This script uses a sixty-second timeout (sixty thousand
        milliseconds) to update the clock.  It updates the
        window by loading five images: each clock digit and a
        colon. These elements are extracted from the current
        hour and minute and assembled in order on a black 
        background.
    </FONT>        

<h5>Copyright &copy;1998 by Charles River Media, All Rights Reserved</h5>
</BODY>
</HTML>